
import java.util.Random;

public class SeedPopulation {
	
	int[][] seedPopulation;
	Integer xSize;
	Integer ySize;
	
	public SeedPopulation(Integer x, Integer y)
	{
		init(x,y);
	}
	
	public SeedPopulation(Integer x, Integer y, DisplayGrid grid)
	{
		init(x,y);
		grid.updateDisplaly(seedPopulation);
	}
	
	public SeedPopulation(Integer x, Integer y, DisplayGrid grid, boolean usePrecalc)
	{
		xSize = x;
		ySize = y;
		seedPopulation = preCalcSeed;
		assert(xSize == seedPopulation.length);
		assert(ySize == seedPopulation[0].length);
		grid.updateDisplaly(seedPopulation);
	}
	
	private void init(Integer x, Integer y)
	{
		xSize = x;
		ySize = y;
		seedPopulation = new int[x][y];
		Random rn = new Random(Math.abs(System.nanoTime()));
		for(int i=0;i<x; i++){
			for(int j=0;j<y; j++)
			{
				seedPopulation[i][j] = rn.nextInt(2);
			}
		}
	}
	
	public void printValues()
	{
		System.out.print("{");
		for (int i=0;i<xSize;i++)
		{
			if(i!=0) System.out.print(",");
			System.out.print("{");
			for(int j=0;j<ySize;j++)
			{
				if(j!=0) System.out.print(",");
				System.out.print(seedPopulation[i][j]);
			}
			System.out.print("}");
		}
		System.out.println("}");
	}
	public Integer getXSize() { return xSize;}
	
	public Integer getYSize() { return ySize;}

	public static final int[][] preCalcSeed =
	{{1,0,0,1,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,1,0,0,0},{1,1,0,1,0,1,0,1,1,0,0,0,0,0,0,0,1,0,0,1,1,0,1,0,0,1,0,1,1,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,1,1,1},{1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,1,0,1,0,1,0,1,1,1,0,0,0,0,0,1,1,0,0,1,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0},{0,1,1,1,0,1,0,1,0,1,0,0,0,0,1,0,1,1,0,1,0,0,0,1,1,1,0,1,1,1,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